package com.hl.exception;

import com.hl.util.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Hr
 * @date 2024/9/12 9:49
 */

//@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(ArithmeticException.class)
    public R expHandler1(){
        return R.exp("算术异常");
    }

    @ExceptionHandler(NullPointerException.class)
    public R expHandler2(){
        return R.exp("空指针异常");
    }

    @ExceptionHandler(Exception.class)
    public R expHandler3(){
        return R.exp("未知异常，请联系管理员");
    }

}
